<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body style="">
  <div class="fr next mr20 mb10">
    <span class="fl" style="line-height: 30px;">共<span class="fontpink">${totalRecords}</span>条记录</span>
    <s:if test="%{totalPages > 0}">
      <s:if test="%{currentPage == 1}">
        <a href="javascript:;">上一页</a>
      </s:if>
      <s:if test="%{currentPage > 1}">
        <a href="${param.url}p=${currentPage - 1}&pz=${pageSize}&search=${search}">上一页</a>
      </s:if>
      <a href="${param.url}p=1&pz=${pageSize}&search=${search}"
        style="${currentPage == 1 ? 'background: #f7f7f7; color: #fd6002;' : ''}">1</a>
      <s:if test="%{currentPage - 1 > 3}">
        <span class="fl">...</span>
        <a href="${param.url}p=${currentPage - 2}&pz=${pageSize}&search=${search}">${currentPage - 2}</a>
        <a href="${param.url}p=${currentPage - 1}&pz=${pageSize}&search=${search}">${currentPage - 1}</a>
      </s:if>
      <s:if test="%{currentPage > 1 && currentPage - 1 <= 3}">
        <s:iterator end="1" begin="%{currentPage - 2}" id="i" step="-1">
          <a href="${param.url}p=${currentPage - i}&pz=${pageSize}&search=${search}">${currentPage - i}</a>
        </s:iterator>
      </s:if>
      <s:if test="%{currentPage > 1 && currentPage < totalPages}">
        <a href="${param.url}p=${currentPage}&pz=${pageSize}&search=${search}" style="background: #f7f7f7; color: #fd6002;">${currentPage}</a>
      </s:if>
      <s:if test="%{totalPages - currentPage > 3}">
        <a href="${param.url}p=${currentPage + 1}&pz=${pageSize}&search=${search}">${currentPage + 1}</a>
        <a href="${param.url}p=${currentPage + 2}&pz=${pageSize}&search=${search}">${currentPage + 2}</a>
        <span class="fl">...</span>
      </s:if>
      <s:if test="%{totalPages > currentPage && totalPages - currentPage <= 3}">
        <s:iterator end="%{totalPages - currentPage - 1}" begin="1" id="i">
          <a href="${param.url}p=${currentPage + i}&pz=${pageSize}&search=${search}">${currentPage + i}</a>
        </s:iterator>
      </s:if>
      <s:if test="%{totalPages >= currentPage && totalPages != 1}">
        <a href="${param.url}p=${totalPages}&pz=${pageSize}&search=${search}"
          style="${currentPage == totalPages ? 'background: #f7f7f7; color: #fd6002;' : ''}">${totalPages}</a>
      </s:if>
      <s:if test="%{currentPage == totalPages}">
        <a href="javascript:;">下一页</a>
      </s:if>
      <s:if test="%{currentPage < totalPages}">
        <a href="${param.url}p=${currentPage + 1}&pz=${pageSize}&search=${search}">下一页</a>
      </s:if>
      <span class="fl page_text">&nbsp;到 &nbsp;</span>
      <input onkeyup="this.value=this.value.replace(/\D/g, '');checkPageInput(this, ${totalPages});" name="inputPage" maxlength="10" class="next_text fl" style="text-align: center;">
      <span class="fl page_text">&nbsp;页&nbsp;</span>
    </s:if>
      <%if (Integer.parseInt(request.getAttribute("totalPages").toString()) > 0) { %>
        <input type="button" value="确定" onclick="location.href='${param.url}p=' + $(this).prev().prev().val() + '&pz=${pageSize}'+'&search=${search}';" class="next_but fl">
      <%} %>
  </div>
</body>
</html>
